82. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2020-08-14 00:01:33 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

82.1 Files compared

#LocationFileLast Modified
1Porto v3.2.3/Magento 2.x/Porto Theme/app/code/Mageplaza/LayeredNavigation/Plugin/Block/SwatchesRenderLayered.php2018-10-10 20:33:20 +0000
2Porto v3.2.4/Magento 2.x/Porto Theme/app/code/Mageplaza/LayeredNavigation/Plugin/Block/SwatchesRenderLayered.php2020-06-26 11:11:14 +0000

82.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged16178
Changed1349
Inserted28
Removed00

82.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

82.4 Active regular expressions

No regular expressions were active.

82.5 Comparison detail

1 <?php 1 <?php
2 /** 2 /**
3  * Mageplaza 3  * Mageplaza
4  * 4  *
5  * NOTICE OF LICENSE 5  * NOTICE OF LICENSE
6  * 6  *
7  * This source file is subject to the Mageplaza.com license that is 7  * This source file is subject to the Mageplaza.com license that is
8  * available through the world-wide-web at this URL: 8  * available through the world-wide-web at this URL:
9  * https://www.mageplaza.com/LICENSE.txt 9  * https://www.mageplaza.com/LICENSE.txt
10  * 10  *
11  * DISCLAIMER 11  * DISCLAIMER
12  * 12  *
13  * Do not edit or add to this file if you wish to upgrade this extension to newer 13  * Do not edit or add to this file if you wish to upgrade this extension to newer
14  * version in the future. 14  * version in the future.
15  * 15  *
16  * @category    Mageplaza 16  * @category    Mageplaza
17  * @package     Mageplaza_LayeredNavigation 17  * @package     Mageplaza_LayeredNavigation
18  * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/) 18  * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/)
19  * @license     https://www.mageplaza.com/LICENSE.txt 19  * @license     https://www.mageplaza.com/LICENSE.txt
20  */ 20  */
21  21 
22 namespace Mageplaza\LayeredNavigation\Plugin\Block\Swatches; 22 namespace Mageplaza\LayeredNavigation\Plugin\Block\Swatches;
23  23 
    24 use Magento\Catalog\Model\Layer\Filter\AbstractFilter;
    25 use Magento\Framework\UrlInterface;
    26 use Magento\Swatches\Block\LayeredNavigation\RenderLayered as SwatchesRenderLayered;
    27 use Magento\Theme\Block\Html\Pager;
    28 use Mageplaza\LayeredNavigation\Helper\Data;
    29 
24 /** 30 /**
25  * Class RenderLayered 31  * Class RenderLayered
26  * @package Mageplaza\LayeredNavigation\Block\Plugin\Swatches 32  * @package Mageplaza\LayeredNavigation\Block\Plugin\Swatches
27  */ 33  */
28 class RenderLayered 34 class RenderLayered
29 { 35 {
30     /** @var \Magento\Framework\UrlInterface */ 36     /** @var 
UrlInterface */
31     protected $_url; 37     protected $_url;
32  38 
33     /** @var \Magento\Theme\Block\Html\Pager */ 39     /** @var 
Pager */
34     protected $_htmlPagerBlock; 40     protected $_htmlPagerBlock;
35  41 
36     /** @var \Mageplaza\LayeredNavigation\Helper\Data */ 42     /** @var Data */
37     protected $_moduleHelper; 43     protected $_moduleHelper;
38  44 
39     /** @type \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ 45     /** @type 
AbstractFilter */
40     protected $filter; 46     protected $filter;
41  47 
42     /** 48     /**
43      * RenderLayered constructor. 49      * RenderLayered constructor.
44      * 50      *
45      * @param \Magento\Framework\UrlInterface $url 51      * @param 
UrlInterface $url
46      * @param \Magento\Theme\Block\Html\Pager $htmlPagerBlock 52      * @param 
Pager $htmlPagerBlock
47      * @param \Mageplaza\LayeredNavigation\Helper\Data $moduleHelper 53      * @param 
Data $moduleHelper
48      */ 54      */
49     public function __construct( 55     public function __construct(
50         \Magento\Framework\UrlInterface $url, 56         
UrlInterface $url,
51         \Magento\Theme\Block\Html\Pager $htmlPagerBlock, 57         
Pager $htmlPagerBlock,
52         \Mageplaza\LayeredNavigation\Helper\Data $moduleHelper 58         
Data $moduleHelper
53     )
 59     ) {
54     {    
55         $this->_url            = $url; 60         $this->_url            = $url;
56         $this->_htmlPagerBlock = $htmlPagerBlock; 61         $this->_htmlPagerBlock = $htmlPagerBlock;
57         $this->_moduleHelper   = $moduleHelper; 62         $this->_moduleHelper   = $moduleHelper;
58     } 63     }
59  64 
60     /** 65     /**
61      * @param \Magento\Swatches\Block\LayeredNavigation\RenderLayered $subject 66      * @param SwatchesRenderLayered $subject
62      * @param \Magento\Catalog\Model\Layer\Filter\AbstractFilter $filter 67      * @param 
AbstractFilter $filter
    68      *
63      * @return array 69      * @return array
64      */ 70      */
65     public function beforeSetSwatchFilter(\Magento\Swatches\Block\LayeredNavigation\RenderLayered $subject, \Magento\Catalog\Model\Layer\Filter\AbstractFilter $filter) 71     public function beforeSetSwatchFilter(SwatchesRenderLayered $subject, 
AbstractFilter $filter)
66     { 72     {
67         $this->filter = $filter; 73         $this->filter = $filter;
68  74 
69         return [$filter]; 75         return [$filter];
70     } 76     }
71  77 
72     /** 78     /**
73      * @param \Magento\Swatches\Block\LayeredNavigation\RenderLayered $subject 79      * @param SwatchesRenderLayered $subject
74      * @param $proceed 80      * @param $proceed
75      * @param $attributeCode 81      * @param $attributeCode
76      * @param $optionId 82      * @param $optionId
77      * 83      *
78      * @return string 84      * @return string
79      */ 85      */
80     public function aroundBuildUrl( 86     public function aroundBuildUrl(
81         \Magento\Swatches\Block\LayeredNavigation\RenderLayered $subject, 87         SwatchesRenderLayered $subject,
82         $proceed, 88         $proceed,
83         $attributeCode, 89         $attributeCode,
84         $optionId 90         $optionId
85     )
 91     ) {
86     {    
87         if (!$this->_moduleHelper->isEnabled()) { 92         if (!$this->_moduleHelper->isEnabled()) {
88             return $proceed($attributeCode, $optionId); 93             return $proceed($attributeCode, $optionId);
89         } 94         }
90  95 
91         $attHelper = $this->_moduleHelper->getFilterModel(); 96         $attHelper = $this->_moduleHelper->getFilterModel();
92         if ($attHelper->isMultiple($this->filter)) { 97         if ($attHelper->isMultiple($this->filter)) {
93             $value = $attHelper->getFilterValue($this->filter); 98             $value = $attHelper->getFilterValue($this->filter);
94  99             if (
in_array($optionId, $value, true)) {
95             if (!in_array($optionId, $value
)) {
 100                 $key = array_search($optionId, $value, true);
96                 $value[] = $optionId;    
97             } else {    
98                 $key = array_search($optionId, $value
);
    
99                 if ($key !== false) { 101                 if ($key !== false) {
100                     unset($value[$key]); 102                     unset($value[$key]);
101                 } 103                 }
    104             } else {
    105                 $value[] = $optionId;
102             } 106             }
103         } else { 107         } else {
104             $value = [$optionId]; 108             $value = [$optionId];
105         } 109         }
106  110 
107         //Sort param on Url 111         //Sort param on Url
108         sort($value); 112         sort($value);
109  113 
110         $query = !empty($value) ? [$attributeCode => implode(',', $value)] : ''; 114         $query = !empty($value) ? [$attributeCode => implode(',', $value)] : '';
111  115 
112         return $this->_url->getUrl( 116         return $this->_url->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true, '_query' => $query]);
113             '*/*/*',    
114             
['_current' => true, '_use_rewrite' => true, '_query' => $query]
    
115         );    
116     } 117     }
117 } 118 }